﻿using Microsoft.Extensions.Configuration;
using MiniFox.Configurations;

namespace MiniFox.Web.Configurations.CrossDomain
{
    /// <summary>
    /// 
    /// </summary>
    [Section(ELEMENT_NAME)]
    public class CrossDomainConfiguration
    {
        internal const string ELEMENT_NAME = "crossDomain";
        /// <summary>
        /// 
        /// </summary>
        public CrossDomainConfiguration()
        {
            this.Credentials = false;
            this.MaxAge = 3600;
        }

        /// <summary>
        /// 例外配置集
        /// </summary>    
        [ConfigurationKeyName("exceptions")]
        public string[] ExceptionRequests
        {
            get;
            set;
        } = new string[0];
        /// <summary>
        /// 域配置集
        /// </summary>    
        [ConfigurationKeyName("origins")]
        public string[] Origins
        {
            get;
            set;
        } = new string[0];
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("headers")]
        public string[] Headers
        {
            get;
            set;
        } = new string[0];
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("exposeHeaders")]
        public string[] ExposeHeaders
        {
            get;
            set;
        } = new string[0];
        /// <summary>
        /// 默认支持方法
        /// </summary>
        [ConfigurationKeyName("methods")]
        public string[] Methods
        {
            get;
            set;
        } = new string[0];
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("credentials")]
        public bool Credentials
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("maxAge")]
        public int MaxAge
        {
            get;
            set;
        }

    }
}
